Cauchy sequence
#analysis
Definition
In a metric space, a sequence is a Cauchy sequence if, for every , almost all terms are within of each other (relative to metric ), i.e.
(for real numbers, using )
Lean4 definition
Cauchy sequences. Usually defined on ℕ, but often it is also useful to say that a function defined on ℝ is Cauchy at +∞ to deduce convergence. Therefore, we define it in a type class that is general enough to cover both ℕ and ℝ, which are the main motivating examples
def CauchySeq [Preorder β] (u : β → α) :=
Cauchy (atTop.map u)
(preorder as in a reflexive and transitive relation ≤, atTop the filter representing limit → ∞ on an ordered set)
A filter
fis Cauchy if for every entourager, there exists ans ∈ fsuch thats × s ⊆ r. This is a generalization of Cauchy sequences, because ifa : ℕ → αthen the filter of sets containing cofinitely many of thea nis Cauchy iffais a Cauchy sequence.
def Cauchy (f : Filter α) :=
NeBot f ∧ f ×ˢ f ≤ 𝓤 α
(NeBot means the filter is not equal to ⊥ i.e. empty set does not belong to the filter, ×ˢ refers to Cartesian product, 𝓤 means uniformity as in a filter on α × α inferred from an ambient uniform space structure on α, and α is a type)